# https://gitee.com/chen2ha/dockerfile
## base-image-alpine
FROM baseimage:alpine3.20

ENV KEEPALIVED_VERSION="2.3.1"

RUN apk --no-cache add --virtual build-dependencies \
        musl-dev \
        openssl-dev \
        make \
        linux-headers \
    && apk --no-cache add \
        gcc \
        ipset \
        openssl \
        iptables \
        autoconf \
    && curl -o keepalived.tar.gz -SL https://keepalived.org/software/keepalived-${KEEPALIVED_VERSION}.tar.gz \
    && tar xf keepalived.tar.gz \
    && cd keepalived-${KEEPALIVED_VERSION} \
    && ./configure --disable-dynamic-linking \
    && make \
    && make install \
    && apk del build-dependencies \
    && rm -rf /var/cache/apk/* \
    && rm -rf /root/.cache \
    && rm -rf /root/.cargo